home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / GameKit / Apps / HighScoreTester / HighScoreTesterController.m < prev    next >
Text File  |  1995-06-12  |  2KB  |  61 lines

  1.  
  2. #import "HighScoreTesterController.h"
  3. #import <daymisckit/daymisckit.h>
  4. #import <gamekit/gamekit.h>
  5.  
  6. @implementation HighScoreTesterController
  7.  
  8. - init
  9. {    // set up an animator to periodically update the high score slot display
  10.     [super init];
  11.     animator = [[Animator alloc] initChronon:1.0
  12.             adaptation:0.0   target:self
  13.             action:@selector(updateSlot:) autoStart:YES eventMask:0];
  14.     return self;
  15. }
  16.  
  17. - trapPause:sender
  18. { // so we can update our interface when pausing is done
  19.     id aString = [[DAYString alloc] initString:"The game is currently "];
  20.     [aString cat:[pauseMenuCell title]];
  21.     [aString cat:"d."];
  22.     [pauseMonitor setStringValue:[aString stringValue]];
  23.     return [gameBrain pauseGame:sender];
  24. }
  25.  
  26. - nextLevelWithoutCheat:sender
  27. {
  28.     [gameBrain nextLevel];
  29.     [self updateSlot:self];
  30.     return self;
  31. }
  32.  
  33. - sendScore:sender
  34. {
  35.     [scoreKeeper addToScore:[scoreText intValue]];
  36.     [self updateSlot:self];
  37.     return self;
  38. }
  39.  
  40. - updateSlot:sender
  41. {    // display the values of the slot in the Matrix.
  42.     id theSlot = [gameBrain currentHighScoreSlot]; // get info from GameBrain
  43.     [[slotMatrix findCellWithTag:0]
  44.             setStringValue:[[theSlot startTime] stringValue]];
  45.     [[slotMatrix findCellWithTag:1]
  46.             setStringValue:[[theSlot endTime] stringValue]];
  47.     [[slotMatrix findCellWithTag:2]
  48.             setStringValue:[[theSlot elapsedTime] stringValue]];
  49.     [[slotMatrix findCellWithTag:3] setStringValue:[theSlot playerName]];
  50.     [[slotMatrix findCellWithTag:4] setStringValue:[theSlot userName]];
  51.     [[slotMatrix findCellWithTag:5] setStringValue:[theSlot machineName]];
  52.     [[slotMatrix findCellWithTag:6] setIntValue:[theSlot startLevel]];
  53.     [[slotMatrix findCellWithTag:7] setIntValue:[theSlot endLevel]];
  54.     [[slotMatrix findCellWithTag:8] setIntValue:[theSlot finalScore]];
  55.     [cheatSwitch setState:[gameBrain playerCheated]];
  56.     return self;
  57. }
  58.  
  59.  
  60. @end
  61.